<?php

class ActorController extends Zend_Controller_Action {

    public function init() {
        $this->view->baseUrl = $this->_request->getBaseUrl();
    }

    public function indexAction() {
       
        $this->view->title = "Movie";
    }

    // one movie
    public function actorAction() {
        $param = $this->getRequest()->getParams();
    	if(isset($param['id'])) { 
        	$actorDB = new Application_Model_Actor;
        	$this->view->actor = $actorDB->getActor2($param['id']);
        	
        	$moviehasactorDB = new Application_Model_MoviehasActor;
            $this->view->movies = $moviehasactorDB->getMovies($param['id']);
        	
        	$this->view->title = "Actor - ".$this->view->actor["Name"];
    	} else {
    		 $this->_redirect("Index/index");
    	}
    }
    
     public function searchAction() {
        $param = $this->getRequest()->getParams();
        
        $actorDB = new Application_Model_Actor;
        $this->view->results = $actorDB->search($param['text']);
        $this->_helper->layout->disableLayout();
    }
    
    

}

